Component({
  properties: {
    inputValue: {
      type: String,
      value: ''
    },
  },
  data: {
    showcancel: false,
    inputValue: '',
  },
  methods: {
    bindKeyInput: function (e) {
      this.setData({
        showcancel: true,
        inputValue: e.detail.value,
      })
    },
    bindKeyBlur: function () {
      if (this.data.inputValue === '') {
        this.setData({
          showcancel: false,
        })
      }
    },
    clearsearch: function () {
      this.setData({
        showcancel: false,
        inputValue: '',
      })
    },
    getSearchResult: function () {
      this.triggerEvent('searchParentEvent', this.data.inputValue)
    },
  },
})
